<template>
  <t-skeleton :loading="loading">  
    <div class="content" v-if="extensionFile.length>0">
      <t-collapse class="list" default-expand-all>
        <t-collapse-panel
          v-for="_ in extensionFile"
          :id="_.id"
          :key="_.value"
          :header="'申请时间:'+dayjs(_.createTime).format('YYYY-MM-DD HH:mm:ss') +' 实际竣工时间延期至'+dayjs(_.extensionTime).format('YYYY-MM-DD')"
        >
        <image-viewer :images="(_.fileUrl).map((f: Record<string, string>) => f)" width="80px" height="80px" />
        </t-collapse-panel>
      </t-collapse>
    </div>
    <!-- 空 -->
    <t-empty v-else style="margin: 100px">
      
    </t-empty>
    <!-- 自定义对话框 -->
   
  </t-skeleton>
  
</template>

<script setup lang="ts">
import dayjs from 'dayjs';
import { MessagePlugin } from 'tdesign-vue-next';
import { computed, inject, onMounted, reactive, Ref, ref, useTemplateRef, watch } from 'vue';

import { createDesignInfo, getDesignInfoList } from '@/api/order/details';
import CustomDialog from '@/components/custom/dialog/index.vue';
import ImageViewer from '@/components/image-viewer/index.vue';
import { useDictionaryStore, useUserStore } from '@/store';
import { engineeringContractYanqiCRUD } from '@/api/project/details';

// 用户仓库
const userStore = useUserStore();
// 字典仓库
const dictionaryStore = useDictionaryStore();
// 订单详情
const engineeringDetails = inject<Ref<Record<string, any>>>('engineeringDetails');

// 加载状态
const loading = ref(false);

const extensionFile = ref([])
// 处理获取量房信息列表
const handleGetMeasureInfoList = () => {
  loading.value = true;
  const params = {
    orderId: engineeringDetails.value.orderId || engineeringDetails.value.id,
    pageSize: -1,
  };
  engineeringContractYanqiCRUD.page(params)
    .then((data) => {
      data.list.forEach((item:any)=>{
        item.fileUrl = JSON.parse(item.fileUrl)
      })
      extensionFile.value = data.list
      console.log(extensionFile.value,'pp');
      
    })
    .catch(({ message }) => {
      MessagePlugin.error(message);
    })
    .finally(() => {
      loading.value = false;
    });
};
onMounted(() => {
  handleGetMeasureInfoList();
});






</script>

